<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title>加载中...</title>
	<link rel="stylesheet" href="./lib/element/index.css">
</head>
<body>
<style>
body{margin:0;}
html,body,#app{height:100%;}
</style>
<div id="app"><router-view></router-view><xi-loading v-model="load.value" :title="load.title"></xi-loading></div>
<script src="./lib/vue.js"></script>
<script src="./lib/vue-router.min.js"></script>
<script src="./lib/less.min.js"></script>
<script src="./lib/element/index.js"></script>
<script src="./lib/xaoi.js"></script>

<script id="mainjs" type="text/js">
import components_index from '@/components/index.js'
Vue.use(components_index)

var search = location.search.substr(1).split('&')
var req = {};
for(var i in search){
	var s = search[i].split('=')
	req[s.splice(0,1).join('')] = s.join('')
}

var hurl = req.action || 'index';

switch(req.action){
	
}

location.hash = '/'+hurl

var routes = function(){
	return [
		{
			path: '/index',
			name: 'index',
			component:()=>import('views/index.vue'),
			meta:{
				args:req,
			}
		},
	]
}

Vue.prototype.$post = xaoi.ajax(function(){
	this.req.url = '?action=' + this.req.url;
})

Vue.prototype.$next = ()=>{return new Promise(ok=>Vue.prototype.$nextTick(ok))}

window.app = new Vue({
	el:'#app',
	router:new VueRouter({routes:routes()}),
	data(){
		return {
			load:{
				value:false,
				title:''
			},
		}
	},
	created(){
		Vue.prototype.$load = (d)=>{
			if(d === false){
				this.load.value = false;
			}else{
				this.load.title = d||'加载中';
				this.load.value = true;
			}
		}
	}
})
</script>

<script>xaoi.import('main.js',{el:'#mainjs'})</script>
</body>
</html>